<template>
  <div class="app">
    <h2>我是App</h2>
    <h4 v-show="wanju">儿子给的玩具：{{wanju}}</h4>
    <Child :getToy="getToy"/>
  </div>
</template>

<script>
  import Child from './components/Child.vue'
  export default {
    name:'App',
    components:{Child},
    data() {
      return {
        wanju:''
      }
    },
    methods: {
      getToy(value){
        console.log('我是父',value)
        this.wanju = value
      }
    },
  }
</script>

<style>
  .app {
    background-color: #ddd;
    border-radius: 10px;
    box-shadow: 0 0 10px;
    padding: 20px;
  }
</style>